package com.weibo4j.api.response.favourite;

import java.util.List;

import com.weibo4j.api.WeiboResponse;
import com.weibo4j.api.json.JSON;
import com.weibo4j.api.vo.FavouriteVO;

public class FavouriteIdsGetResponse extends WeiboResponse<List<FavouriteVO>> {

    private List<FavouriteVO> model;

    public Integer getTotalNumber() {
        return result.getInteger("total_number");
    }

    @Override
    public List<FavouriteVO> getModel() {
        if (success && model == null) {
            isSuccess();
        }
        return model;
    }

    @Override
    public boolean isSuccess() {
        boolean isSuccess = super.isSuccess();
        if (isSuccess && model == null) {
            model = JSON.parseArray(result.getString("favorites"), FavouriteVO.class);
        }
        return isSuccess;
    }

}
